package JCT_Chapter_03;

import java.util.Arrays;

public class TwoMentionArray {
    public static void main(String[] args) {
        int[][] example = new int[2][2];
        int[][] magicSquare = {
                {1,2,3,4},
                {5,6,7,8},
                {9,10,11,12},
                {13,14,15,16}
        };
        // 输出二维数组的默认初始值
        System.out.println(example[0][0]);
        System.out.println(example[0][1]);
        System.out.println(example[1][0]);
        System.out.println(example[1][1]);
        // 输出二维数组的指定元素
        System.out.println(magicSquare[2][2]);
        // 快速打印一个二维数组的数组元素列表
        System.out.println(Arrays.deepToString(magicSquare));
        // 利用for-each循环处理二维数组
        for(int[] row : magicSquare) {
            for(int value : row) {
                System.out.println(value + 1);
            }
        }
        System.out.println(Arrays.deepToString(magicSquare));
    }
}
